#pragma once

#include "../QRSWidgetBase.h"
#include "ui_BooleanOperationWidget.h"

#include "Render/QIVtkSelectionPipeline.h"
#include "Core/RWTools.h"

QT_BEGIN_NAMESPACE
namespace Ui { class BooleanOperationWidgetClass; };
QT_END_NAMESPACE

class MainWindow;
class ShapeOperation;

class BooleanOperationWidget : public QRSWidgetBase
{
	Q_OBJECT

public:
	BooleanOperationWidget(MainWindow* inMainWindow, ShapeOperation* inOperation = nullptr, QWidget* parent = nullptr);
	virtual ~BooleanOperationWidget();
protected:
	void OnSelectedActor(Handle(QIVtkSelectionPipeline) actor);
	virtual void closeEvent(QCloseEvent* event) override;
	void OnConfirm();
	void OnModify();
	void OnCancelSelTarget();
	void OnCancelSelTool();
	void OnBoolOPChange(int index);
private:
	Ui::BooleanOperationWidgetClass *ui;
	Handle(QIVtkSelectionPipeline) m_selectedActorTarget;
	Handle(QIVtkSelectionPipeline) m_selectedActorTool;
	Handle(QIVtkSelectionPipeline) m_resultActor;

	uint m_selIndex = 1;
	bool bIsModify = false;

	BooleanOP m_op = BooleanOP::Union;
};
